﻿<%@ Page Title="" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master"
    AutoEventWireup="true" CodeBehind="GroupManagement.aspx.cs" Inherits="PepsiCo.UI.GroupManagement" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CssContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#dialog-form").dialog({
                autoOpen: false,
                width:600,
                modal: true,
                close: function () {
                }
            });
            $("#dialog-form").parent().appendTo($("form:first"))
        });

        function dialog() {
            $("#dialog-form").dialog({
                autoOpen: false,
                width:600,
                modal: true,
            });
            $("#dialog-form").dialog('open');
            return false;
        }

        function CheckName(){
            if($.trim($("#<%=txtGroupName.ClientID%>").val()) == ""){
                $("#required").html("group name is required").show();
                return false;
            }
            return true;
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-list">
                </div>
                <h1>
                    List Of Group</h1>
                <ul class="buttons">
                    <li>
                        <asp:LinkButton ID="lbtnAddNew" runat="server" CssClass="isw-plus" ToolTip="Add new Group"
                            OnClick="lbtnAddNew_Click" />
                    </li>
                </ul>
                <div class="clear">
                </div>
            </div>
            <div class="block-fluid  table-sorting">
                <div class="dataTables_wrapper">
                    <table width="100%" cellspacing="0" cellpadding="0" class="table" id="tbUsers">
                        <thead>
                            <tr>
                                <th style="width: 40px">
                                    No
                                </th>
                                <th style="width: 35%">
                                    Group Name
                                </th>
                                <th style="width: 50%">
                                    Description
                                </th>
                                <th style="text-align: center; width: 120px">
                                    Action
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <asp:Repeater ID="rptGroup" runat="server" OnItemCommand="rptGroup_ItemCommand">
                                <ItemTemplate>
                                    <tr>
                                        <td style="text-align: center">
                                            <%#(Container.ItemIndex +1)%>
                                        </td>
                                        <td>
                                            <%#Eval("GroupName")%>
                                        </td>
                                        <td>
                                            <%#Eval("Description")%>
                                        </td>
                                        <td style="text-align: center">
                                            <asp:ImageButton ID="ibtnEdit" CommandName="Edit" CommandArgument='<%#Eval("GroupID")%>'
                                                ToolTip="Edit group" ImageUrl="~/images/i_edit.gif" runat="server" />
                                            &nbsp;&nbsp;&nbsp;
                                            <asp:ImageButton ID="ibtnDelete" CommandName="Delete" CommandArgument='<%#Eval("GroupID")%>'
                                                ToolTip="Delete group" ImageUrl="~/images/i_delete.gif" runat="server" OnClientClick="return confirm('Are you sure delete this group?');" />
                                        </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:Repeater>
                        </tbody>
                    </table>
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
    </div>
    <div id="dialog-form" title="Group Information" style="margin: auto;">
        <p>
            <asp:HiddenField ID="hdfGroupId" runat="server" />
            <span>Group Name</span>
            <asp:TextBox ID="txtGroupName" runat="server" autocomplete="off" />
            <span id="required" style="color: Red; display: none">&nbsp;</span>
        </p>
        <p>
            <span>Description</span>
            <asp:TextBox ID="txtDescription" runat="server" autocomplete="off" />
        </p>
        <table border="1" cellpadding="2" cellspacing="2" style="border-collapse: collapse;
            width: 100%" id="tbRole">
            <thead style="background: #4A6C92; height: 35px">
                <tr>
                    <th style="width: 35px">
                        No
                    </th>
                    <th style="width: 200px">
                        Role Name
                    </th>
                    <th style="width: 250px">
                        Description
                    </th>
                    <th style="width: 35px">
                        &nbsp;
                    </th>
                </tr>
            </thead>
            <tbody>
                <asp:Repeater ID="rptRole" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td align="center">
                                <%#(Container.ItemIndex +1) %>
                                <asp:HiddenField ID="hdfRole" runat="server" Value='<%#Eval("RoleId")%>' />
                            </td>
                            <td>
                                <%#Eval("RoleName")%>
                            </td>
                            <td>
                                <%#Eval("Description")%>
                            </td>
                            <td align="center">
                                <asp:CheckBox ID="chkCheck" runat="server" Checked='<%#Eval("Checked")%>' />
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </tbody>
        </table>
        <div style="text-align: right; margin-top: 8px">
            <asp:Button ID="btnOK" runat="server" Text="OK" CssClass="btn" OnClick="btnOK_Click"
                OnClientClick="return CheckName();" />
            &nbsp;
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="btn" OnClientClick='$("#dialog-form").dialog("close"); return false;' />
        </div>
    </div>
    <input type="hidden" id="Action" runat="server" />
    <input type="hidden" id="formId" value="GroupManagement" />
</asp:Content>
